<template>
    <div id="charts">
        <div class="title-wrap">
            <div class="title-text" v-show="$route.fullPath=='/charts/chartsHome'">
                <img src="../../assets/img/charts_icon.png" alt="" />
                <span>统计图表</span>
            </div>
            
            <div class="title-btns">
                <img src="../../assets/img/mini-w.png" @click="windowMin" alt="" />
                <img src="../../assets/img/close-w.png" @click="windowClose" alt="" />
            </div>
        </div>
        <div class="align-center tool-container">
            <div :class="['pointer', 'align-start','toolactive', active?'tool-animation-a':'tool-animation-na']"
                ref="toolkit">
                <img src="../../assets/img/close-circle.png"
                    @click="windowClose" alt=""
                    style="margin-top:18px">
            </div>
            <div class="bottom-toolkit align-center pointer" @click="showToolkit">
                <img src="../../assets/img/active.png" alt="" v-if="active">
                <img src="../../assets/img/resource-toolkit.png" alt="" v-else>
            </div>
        </div>
        <div class="content">
            <div class="back flex-center" v-show="$route.fullPath!=='/charts/chartsHome'" @click="$router.push({name:'ChartsHome'})" style="-webkit-app-region: no-drag;">
                <img src="../../assets/img/back.png" alt="">
                <span class="back-text s-22">返回</span>
            </div>
            <div class="question align-start" style="-webkit-app-region: no-drag;">
                <div :style="`${$route.name==='ChartsHome'?'margin-top:15vh;':''}`">
                    <router-view></router-view>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import mixin from '../../mixin/mixin'
export default {
    mixins: [mixin],
    name: 'charts',
    provide () {
        return {
            title: this.title
        }
    },
    data () {
        return {
            currentCom: 0,//0-工具栏 1-表格
            venn: false,
            dialogVisible: false,
            rowKeys: [],
            title: {
                name: ''
            },
            active: false,
        }
    },
    methods: {
        changeChartsType (type) {
            this.relation = false
            this.$nextTick(() => {
                this.chartSettings.type = type
            })
        },
        showToolkit () {
            this.active = !this.active
        },
        windowMin() {
            this.$electron.ipcRenderer.send("resource-window-minimize", {
              metaId: "charts",
            });
        },
        windowClose() {
            this.deleteArr = []
            this.$electron.ipcRenderer.send("close-resource-window", {
              metaId: "charts",
            });
        },
    },
}
</script>

<style lang="scss" scope>
#charts {
    width: 100%;
    height:100vh;
    background-image: url("../../assets/img/echarts_bg.jpg");
    background-size: cover;
    overflow: hidden;
    .title-wrap {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 64px;
        background-image: url("../../assets/img/title_bg.png");
        background-size: cover;
        -webkit-app-region: drag;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 30px;
        box-sizing: border-box;
        z-index: 99;
  
        .title-text {
          display: flex;
          align-items: center;
            img {
                margin-right: 8px;
                width: 20px;
                height: 20px;
            }
            span {
                font-size: 18px;
                color: #fff;
            }
        }
  
        .title-btns {
        -webkit-app-region: no-drag;
        position: absolute;
        right: 20px;
            img {
                width: 14px;
                height: 14px;
                margin-left: 18px;
                cursor: pointer;
            }
        }
    }
    .content{
        width: 100%;
        height: calc(100vh - 64px);
        display: flex;
        justify-content: center;
     
    }
    .question {
        position: relative;
        top: 200px;
        .title-container {
            transform: translateY(-30px);
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }
    }
    .back {
        position: fixed;
        top: 18px;
        left: 20px;
        z-index: 99;
        img {
            width: 30px;
            height: 30px;
            cursor: pointer;
        }
        .back-text {
            color: #E6EFF6;
            margin-left: 10px;
            cursor: pointer;
        }
    }
}
.make-table {
    .table-type {
        font-size: 18px;
        color: #303133;
        margin-bottom: 10px;
    }
    .table-item {
        width: 22px;
        height: 22px;
        background: rgba(220, 223, 231, 0.1);
        border: 2px solid #dcdfe7;
        margin-right: 4px;
        display: inline-block;
    }
    .table-item-active {
        background: rgba(72, 148, 255, 0.1);
        border: 2px solid #4894ff;
    }
}
.el-message-box__btns {
    transform: rotate(180deg);
    text-align: left !important;
    .el-button {
        transform: rotate(180deg);
    }
}
.tool-container {
    position: fixed;
    bottom: 75px;
    right: 22px;
    width: 60px;
    z-index: 2048;
}
.tool-animation-a {
    animation: maxheight 1s ease forwards;
}
.tool-animation-na {
    animation: minheight 1s ease forwards;
}
.toolactive {
    background-image: url(../../assets/img/toolkit-bg.png);
    background-size: 100% 100%;
    height: 0;
    width: 48px;
    opacity: 0;
    overflow: hidden;
    img {
        width: 24px;
        height: 24px;
    }
}
.bottom-toolkit {
    position: fixed;
    bottom: 75px;
    right: 22px;
    z-index: 100;
    img {
        width: 60px;
        height: 60px;
    }
}
@keyframes maxheight {
    form {
        height: 0;
    }
    to {
        opacity: 1;
        height: 110px;
    }
}
@keyframes minheight {
    form {
        height: 110px;
    }
    to {
        height: 0;
    }
}
</style>